package okl.lab.namesFilter.model
{
	import flash.events.Event;
	
	import mx.collections.ArrayCollection;
	import mx.utils.ObjectProxy;
	
	import okl.lab.namesFilter.controller.events.UsersEvent;
	
	import org.robotlegs.mvcs.Actor;
	
	/**
	 * 	Stores application state and configuration settings.
	 * 	
	 *	@author "oleksandr.kulinchenko@gmail.com"
	 */
	public class AppModel extends Actor
	{
		public function AppModel()
		{
			super();
		}
		
		//{region CONFIG_SETTINGS
		
		//TODO: This section should be externalized in configuration classes/datasources
		[Bindable]public var settings:ObjectProxy = new ObjectProxy(
			{
				usersXmlUrl:  "data/users.xml",
				mockedUsersCount: 50
			}
		);

		/**
		 * Updates users model and notify other framework actors
		 */
		public function set users(value:ArrayCollection):void{
			var event:UsersEvent = new UsersEvent(UsersEvent.UPDATED);
			event.users=value;
			dispatch(event);
		}
	}
}